package com.example.sqliteapplication;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

/**
 * Created by wly on 2019/4/15.
 */

public class MyDBHelper extends SQLiteOpenHelper {

    private String TAG="MyDBHelper";

    public MyDBHelper(Context context) {
        super(context, "student", null, 3);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        Log.i(TAG, "onCreate: "+"建表");
        db.execSQL("create table info(_id varchar(20),name varchar(20))");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        Log.i(TAG, "onUpgrade: ");

        db.execSQL(" alter table info add column phone varchar(20)");


    }
}
